<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

class CreateGoodPricesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('good_prices', function (Blueprint $table) {
            $table->id();
            $table->integer('store_id')->unsigned()->default(0)->comment('店铺id');
            $table->integer('good_id')->unsigned()->default(0)->comment('商品id');
            $table->tinyInteger('level')->unsigned()->default(0)->comment('会员级别:从0开始');
            $table->integer('price')->unsigned()->default(0)->comment('商品零售价，单位分');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE `good_prices` comment '商品会员价格表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('good_prices');
    }
}
